package com.commpany.servie.basic.tag.service.write;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import lombok.extern.slf4j.Slf4j;
import com.commpany.jiedianqian.system.exception.BusinessException;
import com.commpany.jiedianqian.system.exception.SystemErrorEnum;
import com.commpany.servie.basic.tag.api.write.ProductTagWriteService;
import com.commpany.servie.basic.tag.converter.ProductTagConverter;
import com.commpany.servie.basic.tag.business.write.productTag.ProductTagWriteManage;
import com.commpany.servie.basic.tag.model.dto.producttag.ProductTagDTO;
@Slf4j
@Service("productTagWriteService")
public class ProductTagWriteServiceImpl  implements ProductTagWriteService {
	@Autowired
	private ProductTagWriteManage productTagWriteManage;
	
	public int insertProductTagService( ProductTagDTO inputDTO ){
	   try {
	       return productTagWriteManage.insertProductTagService(ProductTagConverter.toPO(inputDTO));
	     } catch (Exception e) {
			// TODO Auto-generated catch block
			log.error("系统异常", e);
			throw new BusinessException(SystemErrorEnum.SYSTEM_ERROR.getValue(), SystemErrorEnum.SYSTEM_ERROR.name());
		}
	}
    public int updateProductTagService( ProductTagDTO inputDTO ){
       try {
           return productTagWriteManage.updateProductTagService(ProductTagConverter.toPO(inputDTO));
        } catch (Exception e) {
			// TODO Auto-generated catch block
			log.error("系统异常", e);
			throw new BusinessException(SystemErrorEnum.SYSTEM_ERROR.getValue(), SystemErrorEnum.SYSTEM_ERROR.name());
		}
    }
    public int deleteProductTagService( ProductTagDTO inputDTO ){
      try {
          return productTagWriteManage.deleteProductTagService(ProductTagConverter.toPO(inputDTO));
      } catch (Exception e) {
			// TODO Auto-generated catch block
			log.error("系统异常", e);
			throw new BusinessException(SystemErrorEnum.SYSTEM_ERROR.getValue(), SystemErrorEnum.SYSTEM_ERROR.name());
		}
    }
}
	